package com.example.bbs.agent.cglib;

import net.sf.cglib.proxy.Enhancer;

/**
 * author: VC
 * create: 2021/7/16 9:52
 * version: 1.0.0
 */
public class Main {
    public static void main(String[] args) {
        //创建类增强器
        Enhancer enhancer = new Enhancer();
        //设置超类
        enhancer.setSuperclass(Student.class);
        //设置回调
        enhancer.setCallback(new ObjectProxy());
        //创建代理类
        Student proxy = (Student)enhancer.create();

        proxy.payMoney();
        proxy.show();
    }
}
